#ifndef _COMMAND_H__
#define _COMMAND_H__
#include "os/types.h"
#include "protocol.h"

typedef enum {
	CMD_Log = 0,
	CMD_Start_Motor = 1,
	CMD_Set_CtrlMode,
	CMD_Set_Plot_Type,
	CMD_Set_Target_Torque,
	CMD_Set_Target_Velocity,
	CMD_Set_Target_Vdq,
	CMD_Set_Target_Currdq,
	CMD_Report_Stat,
	CMD_Report_Plot,
	CMD_Number,
	CMD_Max = 0xEF,
}command_t;


#pragma  pack (push,1)
typedef struct {
	u8   b_started:1;
	u8   ctrl_mode:3;
	u8   res      :4;
	s16  velocity;
	s16  vbus_curr;
	s16  vbus_vol;
	s16  curr_dq[2];
	s16  vol_dq[2];
	u32  sys_time;
}mot_stat_t;
#pragma  pack (pop)

typedef int (*command_handler_t)(package_t *, u8 *);

void command_package_init(void);
bool process_command_package(package_t *command);

#endif /* _COMMAND_H__ */